6. Minimum Code All FaceWare modules are shipped with "example" or "demo" programs that illustrate use of the modules. These programs have a one- or two- letter prefix that designates the associated module: "vDemoXY" illustrates use of ViewIt, "drDemoXY" of DrawIt, "dbDemoXY" of DocuBase, etc. ("XY" is a compiler designation defined in the "About Compilers" program). Most such demo programs are quite small (2-4 pages) due to their use of FaceIt & ViewIt to automatically handle most menu and window events, and therefore make a good starting point for new projects. Before you explore the vDemoXY (ViewIt) and fDemoXY (FaceIt) demo programs, it is helpful to examine a program that represents the minimum amount of code necessary to open a ViewIt window in a FaceIt-based program. This code is presented below for the 3 major languages supported: • Pascal uses FaceStorLP, FaceProcLP; {C1} begin fRec.uName := 'Minimum.Rsrc'; {C2} FaceIt(nil,DoInit,0,0,0,0); {C3} FaceIt(nil,NewWnd,1000,1,0,0); repeat FaceIt(nil,DoLoop,0,0,0,0); {C4} if (fRec.uMenuID = 1000) then ... until false; end. • C #include "FaceStorLC.h" /*C1*/ void main() { strcpy(fRec.uName,"Minimum.Rsrc"); /*C2*/ FaceIt(0,DoInit,0,0,0,0); /*C3*/ FaceIt(0,NewWnd,1000,1,0,0); for (;;) { FaceIt(0,DoLoop,0,0,0,0); /*C4*/ if (fRec.uMenuID == 1000) ... } } • C++ #include "FaceStorSC.h" /*C1*/ void main() { strcpy(fRec.uName,"Minimum.Rsrc"); /*C2*/ FaceIt(0,DoInit); /*C3*/ FaceIt(0,NewWnd,1000,1); for (;;) { FaceIt(0,DoLoop); /*C4*/ if (fRec.uMenuID == 1000) ... } } • FORTRAN include FaceStorLF.inc !C1 record /FaceRec/ fRec common/FaceStuff/fRec fRec.uName = 'Minimum.Rsrc' !C2 FaceIt(0,DoInit,0,0,0,0) !C3 FaceIt(0,NewWnd,1000,1,0,0) do while (.true.) FaceIt(0,DoLoop,0,0,0,0) !C4 if (fRec.uMenuID = 1000) then ... end do end The "C#" comments refer to later help topics that describe what the associated code is doing: C1 = see Include Files topic C2 = see Resource Files topic C3 = see Initializations topic C4 = see Event Handling topic Please take the time to read these topics so that you have a good idea why FaceIt-based programs are built around these four elements.